package com.shmilyou.dissertationmanagement.resolver;
/* Created with 岂止是一丝涟漪     530060499@qq.com    2018/11/23 */

import lombok.Data;

@Data
public class LoginUser {

    private Integer id;

    private String nickname;

    private String email;

    private static LoginUser instance;  //声明为volatile变量可以禁止重排序以避免空指针

    public static LoginUser getInstance() {

        if (instance != null) {
            return instance;
        }
        synchronized (LoginUser.class) {
            if (instance == null) {
                instance = new LoginUser();
                instance.setId(1);
                instance.setNickname("涟漪");
                instance.setEmail("530060@qq.com");
            }
            return instance;
        }
    }
}
